import { Redirect } from 'react-router-dom'
export default function AuthRoute(props, Component, pathname = '/login') {
    if (localStorage.getItem('token')) {
        return <Component {...props} />
    } else {
        return <Redirect to={{ pathname, state: { from: props.location.pathname } }} />
    }
}